﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace WpfWordsLearner.Converters
{
	public sealed class ListToStringConv:IValueConverter
	{

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (value == null)
				return System.Windows.DependencyProperty.UnsetValue;

			if(value is List<string>)
			{
				StringBuilder sb = new StringBuilder();
				foreach (string item in (value as List<string>))
					sb.AppendLine(item);

				return sb.ToString();
			}
			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			throw new NotImplementedException();
		}
	}
}
